package com.isoft.hospital.controller;

import com.isoft.hospital.common.ResponseData;
import com.isoft.hospital.entity.Patient;
import com.isoft.hospital.entity.Prescription;
import com.isoft.hospital.entity.Register;
import com.isoft.hospital.service.PatientService;
import com.isoft.hospital.service.PrescriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class PatientController {
    @Autowired
    private PatientService service;
    @RequestMapping("selectAllpatient")
    public ResponseData selectAll(){
        ResponseData rd=service.selectAll();
        return rd;

    }
    @RequestMapping("/insertpatient")
    public ResponseData insert(Patient patient){  //department 的封装
        ResponseData rd=service.insert(patient);   //与service类关联
        return rd;
    }
    @RequestMapping("/deletepatient")
    public ResponseData delete(int p_id){
        ResponseData rd=service.delete(p_id);
        return rd;
    }
    @RequestMapping("/updatepatient")
    public ResponseData update(Patient patient){
        ResponseData rd =service.update(patient); //与service关联
        return rd;

    }
    @RequestMapping("/findById")
    public ResponseData findById(int p_id){
        ResponseData rd =service.findById(p_id); //与service关联
        return rd;
    }
    @GetMapping("/findByPsf")
    public ResponseData findBypsf(String p_sf){
        return service.findBypsf(p_sf);
    }
}